/**
 * Created by xuan on 15/12/4.
 */
/**
 * 客户跟进
 */
define(function (require) {
    'use strict';
    var angular = require('angular');
    require('angular-route');
    require('angular-messages');
    require('angular-ui');
    require('angular-interceptor');
    require('/static_public/js/angular_directive/projectTreeSelector');
    require('/static_public/js/angular_directive/modal');
    require('/ydxs_static/public/js/plugins/filterCombobox');
    require('global');
    var environment = require('environment');
    var util = require('util');
    require('./controller');
    require('./directive');
    require('./service');

    (function(){
        var $iframe = $('<iframe frameborder="0" style="width: 0;height: 0;"></iframe>');
        $iframe.attr('src',environment.qmyx + '/api/index.php?r=site/redirect-to&token=' + util.getToken() + '&page=empty')
            .load(function(){
                //$iframe.remove();
            })
            .appendTo($('body'));
    }());

    var app = angular.module('cstAssignApp', ['ngRoute', 'ngInterceptor', 'ngMessages', 'ngPublicUI', 'projectTreeSelector',
        'angular.directive.modal','filterCombobox', 'cstAssignApp.controllers', 'cstAssignApp.services', 'cstAssignApp.directives']);
    app.constant('PAGE_SIZE', '10')
        .config(['$routeProvider', function ($routeProvider) {
            $routeProvider
                .when('/following', {redirectTo: '/following/follow_cus'})
                .when('/following/follow_cus', {templateUrl: 'inc/follow_cus.html', controller: 'followingCtrl'})
                .when('/following/overdue_cus', {templateUrl: 'inc/overdue_cus.html', controller: 'followingCtrl'})
                .when('/following/invalid_cus', {templateUrl: 'inc/invalid_cus.html', controller: 'followingCtrl'})
                .when('/public_customer', {templateUrl: 'inc/public_customer.html', controller: 'publicCtrl'})
                .when('/dustbin', {templateUrl: 'inc/dustbin.html', controller: 'rubbishCtrl'})
                .otherwise({redirectTo: '/following/follow_cus'});
        }]);


    angular.element(document).ready(function () {
        angular.bootstrap(document, ['cstAssignApp']);
    });
});
